package day03_oop_code.com.itheima.d6_enum2;

import com.sun.source.tree.BreakTree;

public class Test2 {
    public static void main(String[] args) {
        System.out.println("handleData(3.33,Constant2.UP) = " + handleData(3.33, Constant2.UP));
        System.out.println("handleData(4.33,Constant2.DOWN) = " + handleData(4.33, Constant2.DOWN));
    }
    public static double handleData(double number, Constant2 flag){
        switch (flag){
            case UP:
                number = Math.ceil(number);
                break;
            case DOWN:
                number = Math.floor( number);
                break;
            case HALF_UP:
                number = Math.round(number);
                break;
            case DELETE_LEFT:
                number = (int) number;
                break;
        }
        return number;
    }
}
